<?php

/**
 * Created by PhpStorm.
 * User: 志俊
 * Date: 2015/5/12 0012
 * Time: 12:50
 */
class Friendhref extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
    }

    //新建友情链接
    function new_friend_href()
    {
        $friend_name = $this->input->post('friend_name');
        $friend_href = $this->input->post('friend_href');
        $this->load->model('friendhref_model', 'friend_href', TRUE);
        $friend_href = $this->friend_href->insert_friend_href_info($friend_name, $friend_href);
        echo $friend_href;
    }

    //更新友情链接
    function reset_friend_href()
    {
        $Id = $this->input->post('Id');
        $friend_href = $this->input->post('friend_href');
        $friend_name = $this->input->post('friend_name');
        $this->load->model('friendhref_model', 'friend_href', TRUE);
        $friend_href = $this->friend_href->update_friend_href_info($Id, $friend_name, $friend_href);
        echo $friend_href;
    }

    //删除友情链接
    function delete_friend_href()
    {
        $Id = $this->input->post('Id');
        $this->load->model('friendhref_model', 'friend_href', TRUE);
        $friend_href = $this->friend_href->friend_href_delete($Id);
        echo $friend_href;
    }

    //显示友情链接列表
    function friend_href_list()
    {
        $page = $this->input->post("page");
        $limit = $this->input->post("limit");
        //模型操作,显示文章列表
        $this->load->model('Friendhref_model', 'friend_href', TRUE);
        $data = $this->friend_href->friend_href_page($page, $limit);
        echo json_encode($data);
    }
}